package cn.tedu.controller;/**
 * @Author 金帮嘉诚 @Date 2021-07-20 星期二 9:37
 */
/*本类用于测试*/

import cn.tedu.pojo.Dept;
import cn.tedu.service.DeptService;
import cn.tedu.service.Services;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/**
 * 知识点
 */
@RestController
@CrossOrigin
@RequestMapping("/dept/")
public class DeptController {
    @Autowired
    DeptService deptService;

    @RequestMapping("getAl")
    /*这里方法名可以不一样 但是mapper中方法名必须和xml文件中sql语句的id一样才能识别*/
    public List<Dept> getAl() {
        return deptService.getAll();
    }

    @RequestMapping("getByColumns")
    public List<Dept> getByColumns(Dept dept) {
        return deptService.getByColumns(dept);
    }

    @RequestMapping("getBySeveralId")
    public List<Dept> getBySeveralId(String[] ids) {
//        System.out.println(Arrays.toString(ids));
        return deptService.getBySeveralId(ids);
    }

    //用于测试传多个相同name的html元素的内容 name=id
    @RequestMapping("test1")
    public String[] getData(@RequestParam("id")String[] id){
        System.out.println(id);
        return id;
    }


}
